package cn.iocoder.yudao.module.picturebook.dal.mysql.plan;

import java.time.LocalDate;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.bigplan.BigplanDO;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.plan.PlanDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.plan.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 每日任务表	 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PlanMapper extends BaseMapperX<PlanDO> {

    default PageResult<PlanDO> selectPage(PlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PlanDO>()
                .eqIfPresent(PlanDO::getBigPlanId, reqVO.getBigPlanId())
                .betweenIfPresent(PlanDO::getPlanTime, reqVO.getPlanTime())
                .eqIfPresent(PlanDO::getPlanBook, reqVO.getPlanBook())
                .betweenIfPresent(PlanDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PlanDO::getPlanId));
    }

    PlanDO getPlanByBigPlanIdAndTime(@Param("bigPlanId") Integer bigPlanId, @Param("now") LocalDate now);

    List<PlanDO> getPlanByBigPlanId(@Param("id") Integer id);

    void deletePlanByBigPlanId(Integer id);
}